/**
 * Created by apple on 2017/6/28.
 */


export default class HttpUtils{
  static get(url){
    return new Promise((resolve,reject) =>{
      fetch(url)
        .then(response => response.json())
        .then(result => resolve(result))
        .catch((err) => reject(err))
    })
  }
  static post(post,data){
    return new Promise((resolve,reject) =>{
      fetch(url,{
        method:'POST',
        header:{
          "Accept":'application/json',
          "Content-Type":'application/json'
        },
        body:JSON.stringify(data)
      })
        .then(response => response.json())
        .then(result => resolve(result))
        .catch((err) => reject(err))
    })
  }
}



